DESCRIPTION = "This is an open-source EtherCAT master implementation for Linux"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552"

SRC_URI = "https://www.etherlab.org/download/ethercat/ethercat-1.5.2.tar.bz2 \
           file://Porting-to-i.MX8M.patch \
           "

SRC_URI[md5sum] = "6b4001f8d975865d74a0b108b3bdda3d"
SRC_URI[sha256sum] = "5f34ef3a5e1b8666ae77650917d0ec6eb4d7a437b3b66ea667a61158c8f4e8c4"

inherit module

EXTRA_OEMAKE='KERNEL_DIR="${STAGING_KERNEL_DIR}" PREFIX="${D}"'

S = "${WORKDIR}/ethercat-1.5.2"

EXTRA_OECONF = "--with-linux-dir=${STAGING_KERNEL_BUILDDIR} --enable-generic --disable-8139too --disable-e100 --disable-e1000 --disable-e1000e --disable-r8169 --disable-dependency-tracking --disable-static --enable-shared --enable-userlib"

do_configure () {
  perl ${S}/configure --target=aarch64-poky-linux --host=aarch64-poky-linux --build=x86_64-linux --prefix=${D}/usr --exec-prefix=${D}/usr --sysconfdir=${D}/etc --localstatedir=${D}/var ${EXTRA_OECONF} 
}

do_compile () {
	oe_runmake modules
}

RCONFLICTS_${PN} = "ocf-linux"
RREPLACES_${PN} = "ocf-linux"